home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / OpenTransport / Interfaces / PInterfaces / OpenTransport.p < prev   
Encoding:
Text File  |  1997-11-24  |  64.0 KB  |  1,731 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        OpenTransport.p
  3.  
  4.      Contains:    OpenTransport interfaces
  5.  
  6.      Copyright:    © 1984-1997 by Apple Computer, Inc.
  7.                  All rights reserved.
  8.  
  9. }
  10. {$IFC UNDEFINED UsingIncludes}
  11. {$SETC UsingIncludes := 0}
  12. {$ENDC}
  13.  
  14. {$IFC NOT UsingIncludes}
  15.  UNIT OpenTransport;
  16.  INTERFACE
  17. {$ENDC}
  18.  
  19. {$IFC UNDEFINED __OPENTRANSPORT__}
  20. {$SETC __OPENTRANSPORT__ := 1}
  21.  
  22. {$I+}
  23. {$SETC OpenTransportIncludes := UsingIncludes}
  24. {$SETC UsingIncludes := 1}
  25.  
  26. {$SETC SystemSevenOrLater := 1 }
  27. {$IFC UNDEFINED __TYPES__}
  28. {$I Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED __MIXEDMODE__}
  31. {$I MixedMode.p}
  32. {$ENDC}
  33. {
  34.     -------------------------------------------------------------------------
  35.     Some Typedefs for Pascal
  36.     ------------------------------------------------------------------------- 
  37. }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43.  
  44. TYPE
  45.     size_t                                = LONGINT;
  46. {$SETC NULL := 0 }
  47.     uchar_p                                = LONGINT;
  48.     ushort_p                            = LONGINT;
  49.     short_p                                = LONGINT;
  50.     char_p                                = LONGINT;
  51.     boolean_p                            = LONGINT;
  52.     int_t                                = LONGINT;
  53.     uint_t                                = LONGINT;
  54. {$IFC UNDEFINED OTKERNEL }
  55. {$SETC OTKERNEL := 0 }
  56. {$ENDC}
  57. {$IFC UNDEFINED OTUNIXERRORS }
  58. {$SETC OTUNIXERRORS := 0 }
  59. {$ENDC}
  60. {
  61. ******************************************************************************
  62. ** Gestalt values for Open Transport
  63. *******************************************************************************
  64. }
  65.  
  66. CONST
  67.     gestaltOpenTptVersions        = 'otvr';
  68.     gestaltOpenTpt                = 'otan';
  69.     gestaltOpenTptPresentMask    = $00000001;
  70.     gestaltOpenTptLoadedMask    = $00000002;
  71.     gestaltOpenTptAppleTalkPresentMask = $00000004;
  72.     gestaltOpenTptAppleTalkLoadedMask = $00000008;
  73.     gestaltOpenTptTCPPresentMask = $00000010;
  74.     gestaltOpenTptTCPLoadedMask    = $00000020;
  75.     gestaltOpenTptIPXSPXPresentMask = $00000040;
  76.     gestaltOpenTptIPXSPXLoadedMask = $00000080;
  77.     gestaltOpenTptPresentBit    = 0;
  78.     gestaltOpenTptLoadedBit        = 1;
  79.     gestaltOpenTptAppleTalkPresentBit = 2;
  80.     gestaltOpenTptAppleTalkLoadedBit = 3;
  81.     gestaltOpenTptTCPPresentBit    = 4;
  82.     gestaltOpenTptTCPLoadedBit    = 5;
  83.     gestaltOpenTptIPXSPXPresentBit = 6;
  84.     gestaltOpenTptIPXSPXLoadedBit = 7;
  85.  
  86. {
  87. ******************************************************************************
  88. ** Some prefixes for shared libraries
  89. *******************************************************************************
  90. }
  91.     kOTLibraryVersion    =    '1.1';
  92.     kOTLibraryPrefix    =    'OTLib$';
  93.     kOTModulePrefix        =    'OTModl$';
  94.     kOTKernelPrefix        =    'OTKrnl$';
  95.     kOTClientPrefix        =    'OTClnt$';
  96. {
  97. ******************************************************************************
  98. ** Some typedefs used by the OpenTransport system
  99. *******************************************************************************
  100. }
  101. {
  102.     -------------------------------------------------------------------------
  103.     Miscellaneous typedefs
  104.     ------------------------------------------------------------------------- 
  105. }
  106.  
  107. TYPE
  108.     OTTimeout                            = UInt32;
  109.     OTSequence                            = LONGINT;
  110.     OTNameID                            = LONGINT;
  111.     OTReason                            = SInt32;
  112.     OTQLen                                = UInt32;
  113.     OTClient                            = Ptr;
  114.     OTClientName                        = ^UInt8;
  115.     OTCommand                            = LONGINT;
  116.     CStringPtrPtr                        = ^CStringPtr;
  117. {
  118.     -------------------------------------------------------------------------
  119.     OTOpenFlags - flags used for opening providers
  120.     ------------------------------------------------------------------------- 
  121. }
  122.     OTOpenFlags                            = UInt32;
  123.  
  124. CONST
  125.     O_ASYNC                        = $01;
  126.     O_NDELAY                    = $04;
  127.     O_NONBLOCK                    = $04;
  128.  
  129. {
  130.     -------------------------------------------------------------------------
  131.     StdCLib-style Error codes
  132.     ------------------------------------------------------------------------- 
  133. }
  134.  
  135. TYPE
  136.     OTUnixErr                            = UInt16;
  137. {$IFC OTKERNEL OR OTUNIXERRORS }
  138. {
  139.          * There may be some error code confusions with other compiler vendor header
  140.          * files - However, these match both MPW and AIX definitions.
  141.          * We undefine the #defined ones we know about so that we can put them
  142.          * in an enum.
  143. }
  144.  
  145. CONST
  146.     EPERM                        = 1;                            {  Permission denied                     }
  147.     ENOENT                        = 2;                            {  No such file or directory             }
  148.     ENORSRC                        = 3;                            {  No such resource                         }
  149.     EINTR                        = 4;                            {  Interrupted system service             }
  150.     EIO                            = 5;                            {  I/O error                             }
  151.     ENXIO                        = 6;                            {  No such device or address             }
  152.     EBADF                        = 9;                            {  Bad file number                         }
  153.     EAGAIN                        = 11;                            {  Try operation again later             }
  154.     ENOMEM                        = 12;                            {  Not enough space                         }
  155.     EACCES                        = 13;                            {  Permission denied                     }
  156.     EFAULT                        = 14;                            {  Bad address                             }
  157.     EBUSY                        = 16;                            {  Device or resource busy                 }
  158.     EEXIST                        = 17;                            {  File exists                             }
  159.     ENODEV                        = 19;                            {  No such device                         }
  160.     EINVAL                        = 22;                            {  Invalid argument                         }
  161.     ENOTTY                        = 25;                            {  Not a character device                 }
  162.     EPIPE                        = 32;                            {  Broken pipe                             }
  163.     ERANGE                        = 34;                            {  Math result not representable         }
  164.     EDEADLK                        = 35;                            {  Call would block so was aborted         }
  165.     EWOULDBLOCK                    = 35;                            {  Or a deadlock would occur             }
  166.     EALREADY                    = 37;
  167.     ENOTSOCK                    = 38;                            {  Socket operation on non-socket         }
  168.     EDESTADDRREQ                = 39;                            {  Destination address required             }
  169.     EMSGSIZE                    = 40;                            {  Message too long                         }
  170.     EPROTOTYPE                    = 41;                            {  Protocol wrong type for socket         }
  171.     ENOPROTOOPT                    = 42;                            {  Protocol not available                 }
  172.     EPROTONOSUPPORT                = 43;                            {  Protocol not supported                 }
  173.     ESOCKTNOSUPPORT                = 44;                            {  Socket type not supported             }
  174.     EOPNOTSUPP                    = 45;                            {  Operation not supported on socket     }
  175.     EADDRINUSE                    = 48;                            {  Address already in use                 }
  176.     EADDRNOTAVAIL                = 49;                            {  Can't assign requested address         }
  177.     ENETDOWN                    = 50;                            {  Network is down                         }
  178.     ENETUNREACH                    = 51;                            {  Network is unreachable                 }
  179.     ENETRESET                    = 52;                            {  Network dropped connection on reset     }
  180.     ECONNABORTED                = 53;                            {  Software caused connection abort         }
  181.     ECONNRESET                    = 54;                            {  Connection reset by peer                 }
  182.     ENOBUFS                        = 55;                            {  No buffer space available             }
  183.     EISCONN                        = 56;                            {  Socket is already connected             }
  184.     ENOTCONN                    = 57;                            {  Socket is not connected                 }
  185.     ESHUTDOWN                    = 58;                            {  Can't send after socket shutdown         }
  186.     ETOOMANYREFS                = 59;                            {  Too many references: can't splice     }
  187.     ETIMEDOUT                    = 60;                            {  Connection timed out                     }
  188.     ECONNREFUSED                = 61;                            {  Connection refused                     }
  189.     EHOSTDOWN                    = 64;                            {  Host is down                             }
  190.     EHOSTUNREACH                = 65;                            {  No route to host                         }
  191.     EPROTO                        = 70;
  192.     ETIME                        = 71;
  193.     ENOSR                        = 72;
  194.     EBADMSG                        = 73;
  195.     ECANCEL                        = 74;
  196.     ENOSTR                        = 75;
  197.     ENODATA                        = 76;
  198.     EINPROGRESS                    = 77;
  199.     ESRCH                        = 78;
  200.     ENOMSG                        = 79;
  201.     ELASTERRNO                    = 79;
  202.  
  203. {$ENDC}
  204. {
  205.     -------------------------------------------------------------------------
  206.     Open Transport/XTI Error codes
  207.     ------------------------------------------------------------------------- 
  208. }
  209.  
  210. TYPE
  211.     OTXTIErr                            = UInt16;
  212.  
  213. CONST
  214.     TSUCCESS                    = 0;                            {  No Error occurred                         }
  215.     TBADADDR                    = 1;                            {  A Bad address was specified                 }
  216.     TBADOPT                        = 2;                            {  A Bad option was specified                 }
  217.     TACCES                        = 3;                            {  Missing access permission                 }
  218.     TBADF                        = 4;                            {  Bad provider reference                     }
  219.     TNOADDR                        = 5;                            {  No address was specified                     }
  220.     TOUTSTATE                    = 6;                            {  Call issued in wrong state                 }
  221.     TBADSEQ                        = 7;                            {  Sequence specified does not exist         }
  222.     TSYSERR                        = 8;                            {  A system error occurred                     }
  223.     TLOOK                        = 9;                            {  An event occurred - call Look()             }
  224.     TBADDATA                    = 10;                            {  An illegal amount of data was specified     }
  225.     TBUFOVFLW                    = 11;                            {  Passed buffer not big enough                 }
  226.     TFLOW                        = 12;                            {  Provider is flow-controlled                 }
  227.     TNODATA                        = 13;                            {  No data available for reading             }
  228.     TNODIS                        = 14;                            {  No disconnect indication available         }
  229.     TNOUDERR                    = 15;                            {  No Unit Data Error indication available     }
  230.     TBADFLAG                    = 16;                            {  A Bad flag value was supplied             }
  231.     TNOREL                        = 17;                            {  No orderly release indication available     }
  232.     TNOTSUPPORT                    = 18;                            {  Command is not supported                     }
  233.     TSTATECHNG                    = 19;                            {  State is changing - try again later         }
  234.     TNOSTRUCTYPE                = 20;                            {  Bad structure type requested for OTAlloc     }
  235.     TBADNAME                    = 21;                            {  A bad endpoint name was supplied             }
  236.     TBADQLEN                    = 22;                            {  A Bind to an in-use address with qlen > 0 }
  237.     TADDRBUSY                    = 23;                            {  Address requested is already in use         }
  238.     TINDOUT                        = 24;                            {  Accept failed because of pending listen     }
  239.     TPROVMISMATCH                = 25;                            {  Tried to accept on incompatible endpoint     }
  240.     TRESQLEN                    = 26;
  241.     TRESADDR                    = 27;
  242.     TQFULL                        = 28;
  243.     TPROTO                        = 29;                            {  An unspecified provider error occurred     }
  244.     TBADSYNC                    = 30;                            {  A synchronous call at interrupt time         }
  245.     TCANCELED                    = 31;                            {  The command was cancelled                 }
  246.     TLASTXTIERROR                = 31;
  247.  
  248. {
  249.     -------------------------------------------------------------------------
  250.     Standard negative error codes conforming to both the Open Transport/XTI
  251.     errors and the Exxxxx StdCLib errors.
  252.     These are returned as OSStatus' from functions, and to the OTResult parameter
  253.     of a notification function or method.  However, OTResult may sometimes
  254.     contain other values depending on the notification.
  255.     ------------------------------------------------------------------------- 
  256. }
  257.  
  258. TYPE
  259.     OTResult                            = SInt32;
  260. {
  261.          * These map the Open Transport/XTI errors (the Txxxx error codes), and the
  262.          * StdCLib Exxxx error codes into unique spaces in the Apple OSStatus space.
  263. }
  264.  
  265. CONST
  266.     kOTNoError                    = 0;                            {  No Error occurred                         }
  267.     kOTOutOfMemoryErr            = -3211;
  268.     kOTNotFoundErr                = -3201;
  269.     kOTDuplicateFoundErr        = -3216;
  270.     kOTBadAddressErr            = -3150;                        {  -3150 A Bad address was specified                 }
  271.     kOTBadOptionErr                = -3151;                        {  -3151 A Bad option was specified                     }
  272.     kOTAccessErr                = -3152;                        {  -3152 Missing access permission                     }
  273.     kOTBadReferenceErr            = -3153;                        {  -3153 Bad provider reference                         }
  274.     kOTNoAddressErr                = -3154;                        {  -3154 No address was specified                     }
  275.     kOTOutStateErr                = -3155;                        {  -3155 Call issued in wrong state                     }
  276.     kOTBadSequenceErr            = -3156;                        {  -3156 Sequence specified does not exist             }
  277.     kOTSysErrorErr                = -3157;                        {  -3157 A system error occurred                     }
  278.     kOTLookErr                    = -3158;                        {  -3158 An event occurred - call Look()             }
  279.     kOTBadDataErr                = -3159;                        {  -3159 An illegal amount of data was specified     }
  280.     kOTBufferOverflowErr        = -3160;                        {  -3160 Passed buffer not big enough                 }
  281.     kOTFlowErr                    = -3161;                        {  -3161 Provider is flow-controlled                 }
  282.     kOTNoDataErr                = -3162;                        {  -3162 No data available for reading                 }
  283.     kOTNoDisconnectErr            = -3163;                        {  -3163 No disconnect indication available             }
  284.     kOTNoUDErrErr                = -3164;                        {  -3164 No Unit Data Error indication available     }
  285.     kOTBadFlagErr                = -3165;                        {  -3165 A Bad flag value was supplied                 }
  286.     kOTNoReleaseErr                = -3166;                        {  -3166 No orderly release indication available     }
  287.     kOTNotSupportedErr            = -3167;                        {  -3167 Command is not supported                     }
  288.     kOTStateChangeErr            = -3168;                        {  -3168 State is changing - try again later         }
  289.     kOTNoStructureTypeErr        = -3169;                        {  -3169 Bad structure type requested for OTAlloc     }
  290.     kOTBadNameErr                = -3170;                        {  -3170 A bad endpoint name was supplied             }
  291.     kOTBadQLenErr                = -3171;                        {  -3171 A Bind to an in-use addr with qlen > 0         }
  292.     kOTAddressBusyErr            = -3172;                        {  -3172 Address requested is already in use         }
  293.     kOTIndOutErr                = -3173;                        {  -3173 Accept failed because of pending listen     }
  294.     kOTProviderMismatchErr        = -3174;                        {  -3174 Tried to accept on incompatible endpoint     }
  295.     kOTResQLenErr                = -3175;                        {  -3175                                             }
  296.     kOTResAddressErr            = -3176;                        {  -3176                                             }
  297.     kOTQFullErr                    = -3177;                        {  -3177                                             }
  298.     kOTProtocolErr                = -3178;                        {  -3178 An unspecified provider error occurred         }
  299.     kOTBadSyncErr                = -3179;                        {  -3179 A synchronous call at interrupt time         }
  300.     kOTCanceledErr                = -3180;                        {  -3180 The command was cancelled                     }
  301.     kEPERMErr                    = -3200;                        {   Permission denied                     }
  302.     kENOENTErr                    = -3201;                        {   No such file or directory             }
  303.     kENORSRCErr                    = -3202;                        {   No such resource                     }
  304.     kEINTRErr                    = -3203;                        {   Interrupted system service             }
  305.     kEIOErr                        = -3204;                        {   I/O error                             }
  306.     kENXIOErr                    = -3205;                        {   No such device or address             }
  307.     kEBADFErr                    = -3208;                        {   Bad file number                         }
  308.     kEAGAINErr                    = -3210;                        {   Try operation again later             }
  309.     kENOMEMErr                    = -3211;                        {   Not enough space                     }
  310.     kEACCESErr                    = -3212;                        {   Permission denied                     }
  311.     kEFAULTErr                    = -3213;                        {   Bad address                             }
  312.     kEBUSYErr                    = -3215;                        {   Device or resource busy                 }
  313.     kEEXISTErr                    = -3216;                        {   File exists                             }
  314.     kENODEVErr                    = -3218;                        {   No such device                         }
  315.     kEINVALErr                    = -3221;                        {   Invalid argument                     }
  316.     kENOTTYErr                    = -3224;                        {   Not a character device                 }
  317.     kEPIPEErr                    = -3231;                        {   Broken pipe                             }
  318.     kERANGEErr                    = -3233;                        {   Message size too large for STREAM     }
  319.     kEWOULDBLOCKErr                = -3234;                        {   Call would block, so was aborted     }
  320.     kEDEADLKErr                    = -3234;                        {   or a deadlock would occur             }
  321.     kEALREADYErr                = -3236;                        {                                           }
  322.     kENOTSOCKErr                = -3237;                        {   Socket operation on non-socket         }
  323.     kEDESTADDRREQErr            = -3238;                        {   Destination address required         }
  324.     kEMSGSIZEErr                = -3239;                        {   Message too long                     }
  325.     kEPROTOTYPEErr                = -3240;                        {   Protocol wrong type for socket         }
  326.     kENOPROTOOPTErr                = -3241;                        {   Protocol not available                 }
  327.     kEPROTONOSUPPORTErr            = -3242;                        {   Protocol not supported                 }
  328.     kESOCKTNOSUPPORTErr            = -3243;                        {   Socket type not supported             }
  329.     kEOPNOTSUPPErr                = -3244;                        {   Operation not supported on socket     }
  330.     kEADDRINUSEErr                = -3247;                        {   Address already in use                 }
  331.     kEADDRNOTAVAILErr            = -3248;                        {   Can't assign requested address         }
  332.     kENETDOWNErr                = -3249;                        {   Network is down                         }
  333.     kENETUNREACHErr                = -3250;                        {   Network is unreachable                 }
  334.     kENETRESETErr                = -3251;                        {   Network dropped connection on reset     }
  335.     kECONNABORTEDErr            = -3252;                        {   Software caused connection abort     }
  336.     kECONNRESETErr                = -3253;                        {   Connection reset by peer             }
  337.     kENOBUFSErr                    = -3254;                        {   No buffer space available             }
  338.     kEISCONNErr                    = -3255;                        {   Socket is already connected             }
  339.     kENOTCONNErr                = -3256;                        {   Socket is not connected                 }
  340.     kESHUTDOWNErr                = -3257;                        {   Can't send after socket shutdown     }
  341.     kETOOMANYREFSErr            = -3258;                        {   Too many references: can't splice     }
  342.     kETIMEDOUTErr                = -3259;                        {   Connection timed out                 }
  343.     kECONNREFUSEDErr            = -3260;                        {   Connection refused                     }
  344.     kEHOSTDOWNErr                = -3263;                        {   Host is down                         }
  345.     kEHOSTUNREACHErr            = -3264;                        {   No route to host                     }
  346.     kEPROTOErr                    = -3269;                        {                                           }
  347.     kETIMEErr                    = -3270;                        {                                           }
  348.     kENOSRErr                    = -3271;                        {                                           }
  349.     kEBADMSGErr                    = -3272;                        {                                           }
  350.     kECANCELErr                    = -3273;                        {                                           }
  351.     kENOSTRErr                    = -3274;                        {                                           }
  352.     kENODATAErr                    = -3275;                        {                                           }
  353.     kEINPROGRESSErr                = -3276;                        {                                           }
  354.     kESRCHErr                    = -3277;                        {                                           }
  355.     kENOMSGErr                    = -3278;                        {                                           }
  356.     kOTClientNotInittedErr        = -3279;
  357.     kOTPortHasDiedErr            = -3280;
  358.     kOTPortWasEjectedErr        = -3281;
  359.     kOTBadConfigurationErr        = -3282;
  360.     kOTConfigurationChangedErr    = -3283;
  361.     kOTUserRequestedErr            = -3284;
  362.     kOTPortLostConnection        = -3285;
  363.  
  364. {
  365.     -------------------------------------------------------------------------
  366.     OTAddressType - defines the address type for the OTAddress
  367.     ------------------------------------------------------------------------- 
  368. }
  369.  
  370. TYPE
  371.     OTAddressType                        = UInt16;
  372.  
  373. CONST
  374.     kOTGenericName                = 0;
  375.  
  376. {
  377.     -------------------------------------------------------------------------
  378.     OTAddress - Generic OpenTransport protocol address
  379.     ------------------------------------------------------------------------- 
  380. }
  381.  
  382. TYPE
  383.     OTAddressPtr = ^OTAddress;
  384.     OTAddress = RECORD
  385.         fAddressType:            OTAddressType;
  386.         fAddress:                SInt8;
  387.     END;
  388.  
  389. {
  390.     -------------------------------------------------------------------------
  391.     OTStructType - defines the structure type for the OTAlloc call
  392.     ------------------------------------------------------------------------- 
  393. }
  394.     OTStructType                        = UInt32;
  395.  
  396. CONST
  397.     T_BIND                        = 1;
  398.     T_OPTMGMT                    = 2;
  399.     T_CALL                        = 3;
  400.     T_DIS                        = 4;
  401.     T_UNITDATA                    = 5;
  402.     T_UDERROR                    = 6;
  403.     T_INFO                        = 7;
  404.     T_REPLYDATA                    = 8;
  405.     T_REQUESTDATA                = 9;
  406.     T_UNITREQUEST                = 10;
  407.     T_UNITREPLY                    = 11;
  408.  
  409. {
  410.     -------------------------------------------------------------------------
  411.     OTFlags - flags for sending and receiving data
  412.     ------------------------------------------------------------------------- 
  413. }
  414.  
  415. TYPE
  416.     OTFlags                                = UInt32;
  417.  
  418. CONST
  419.     T_MORE                        = $0001;                        {  More data to come in message         }
  420.     T_EXPEDITED                    = $0002;                        {  Data is expedited, if possible     }
  421.     T_ACKNOWLEDGED                = $0004;                        {  Acknowledge transaction             }
  422.     T_PARTIALDATA                = $0008;                        {  Partial data - more coming         }
  423.     T_NORECEIPT                    = $0010;                        {  No event on transaction done         }
  424.     T_TIMEDOUT                    = $0020;                        {  Reply timed out                     }
  425.  
  426. {
  427.     -------------------------------------------------------------------------
  428.     OTBand - a band value when reading priority messages
  429.     ------------------------------------------------------------------------- 
  430. }
  431.  
  432. TYPE
  433.     OTBand                                = UInt32;
  434. {
  435.     -------------------------------------------------------------------------
  436.     Reference values
  437.     ------------------------------------------------------------------------- 
  438. }
  439.     StreamRef                            = Ptr;
  440.     ProviderRef                            = Ptr;
  441.     EndpointRef                            = Ptr;
  442.     MapperRef                            = Ptr;
  443.  
  444. CONST
  445.     kOTInvalidRef                = 0;
  446.     kOTInvalidStreamRef            = 0;
  447.     kOTInvalidProviderRef        = 0;
  448.     kOTInvalidEndpointRef        = 0;
  449.     kOTInvalidMapperRef            = 0;
  450.  
  451. {
  452.     -------------------------------------------------------------------------
  453.     OTEventCode values for Open Transport - These are the event codes that
  454.     are sent to notification routine during asynchronous processing.
  455.     ------------------------------------------------------------------------- 
  456. }
  457.  
  458. TYPE
  459.     OTEventCode                            = UInt32;
  460. {
  461.      * Function definition to handle notification from providers
  462.      *
  463.      * This is never a UniversalProcPtr.
  464. }
  465.     OTNotifyProcPtr = ProcPtr;  { PROCEDURE OTNotify(contextPtr: UNIV Ptr; code: OTEventCode; result: OTResult; cookie: UNIV Ptr); }
  466.  
  467. {
  468.      * These will be returned by the T_LOOK function, or will be returned
  469.      * if asynchronous notification is used.
  470. }
  471.  
  472. CONST
  473.     T_LISTEN                    = $0001;                        {  An connection request is available      }
  474.     T_CONNECT                    = $0002;                        {  Confirmation of a connect request     }
  475.     T_DATA                        = $0004;                        {  Standard data is available             }
  476.     T_EXDATA                    = $0008;                        {  Expedited data is available             }
  477.     T_DISCONNECT                = $0010;                        {  A disconnect is available             }
  478.     T_ERROR                        = $0020;                        {  obsolete/unused in library             }
  479.     T_UDERR                        = $0040;                        {  A Unit Data Error has occurred         }
  480.     T_ORDREL                    = $0080;                        {  An orderly release is available         }
  481.     T_GODATA                    = $0100;                        {  Flow control lifted on standard data     }
  482.     T_GOEXDATA                    = $0200;                        {  Flow control lifted on expedited data }
  483.     T_REQUEST                    = $0400;                        {  An Incoming request is available         }
  484.     T_REPLY                        = $0800;                        {  An Incoming reply is available         }
  485.     T_PASSCON                    = $1000;                        {  State is now T_DATAXFER                 }
  486.     T_RESET                        = $2000;                        {  Protocol has been reset                 }
  487.  
  488. {
  489.      * kPRIVATEEVENT + 1 through kPRIVATEEVENT + 0xffff
  490.      *        may be used for any private event codes desired.
  491.      *        All other event codes are reserved for Apple Computer, Inc.
  492.      *        use only.
  493. }
  494.     kPRIVATEEVENT                = $10000000;
  495.  
  496. {
  497.      * These are only returned if asynchronous notification is being used
  498. }
  499.     kCOMPLETEEVENT                = $20000000;
  500.     T_BINDCOMPLETE                = $20000001;                    {  Bind call is complete                 }
  501.     T_UNBINDCOMPLETE            = $20000002;                    {  Unbind call is complete                 }
  502.     T_ACCEPTCOMPLETE            = $20000003;                    {  Accept call is complete                 }
  503.     T_REPLYCOMPLETE                = $20000004;                    {  SendReply call is complete             }
  504.     T_DISCONNECTCOMPLETE        = $20000005;                    {  Disconnect call is complete             }
  505.     T_OPTMGMTCOMPLETE            = $20000006;                    {  OptMgmt call is complete                 }
  506.     T_OPENCOMPLETE                = $20000007;                    {  An Open call is complete                 }
  507.     T_GETPROTADDRCOMPLETE        = $20000008;                    {  GetProtAddress call is complete         }
  508.     T_RESOLVEADDRCOMPLETE        = $20000009;                    {  A ResolveAddress call is complet         }
  509.     T_GETINFOCOMPLETE            = $2000000A;                    {  A GetInfo call is complete             }
  510.     T_SYNCCOMPLETE                = $2000000B;                    {  A Sync call is complete                 }
  511.     T_MEMORYRELEASED            = $2000000C;                    {  No-copy memory was released             }
  512.     T_REGNAMECOMPLETE            = $2000000D;                    {  A RegisterName call is complete         }
  513.     T_DELNAMECOMPLETE            = $2000000E;                    {  A DeleteName call is complete         }
  514.     T_LKUPNAMECOMPLETE            = $2000000F;                    {  A LookupName call is complete         }
  515.     T_LKUPNAMERESULT            = $20000010;                    {  A LookupName is returning a name         }
  516.     kOTSyncIdleEvent            = $20000011;                    {  Synchronous call Idle event             }
  517.  
  518. {
  519.      * Events for streams - not normally seen by clients.
  520. }
  521.     kSTREAMEVENT                = $21000000;
  522.     kGetmsgEvent                = $21000002;                    {  A GetMessage call is complete         }
  523.     kStreamReadEvent            = $21000003;                    {  A Read call is complete                 }
  524.     kStreamWriteEvent            = $21000004;                    {  A Write call is complete                 }
  525.     kStreamIoctlEvent            = $21000005;                    {  An Ioctl call is complete             }
  526.     kStreamOpenEvent            = $21000007;                    {  An OpenStream call is complete         }
  527.     kPollEvent                    = $21000008;                    {  A Poll call is complete                 }
  528.     kSIGNALEVENT                = $22000000;                    {  A signal has arrived from the STREAM     }
  529.     kPROTOCOLEVENT                = $23000000;                    {  Some event from the protocols         }
  530.  
  531. {
  532.      * These are miscellaneous events that could be sent to a provider
  533. }
  534.     kOTProviderIsDisconnected    = $23000001;                    {  Provider is temporarily off-line         }
  535.     kOTProviderIsReconnected    = $23000002;                    {  Provider is now back on-line             }
  536.  
  537. {
  538.      * These are system events sent to each provider.
  539. }
  540.     kOTProviderWillClose        = $24000001;                    {  Provider will close immediately         }
  541.     kOTProviderIsClosed            = $24000002;                    {  Provider was closed                     }
  542.  
  543. {
  544.      * These are system events sent to registered clients
  545.      *
  546.      * result code is 0, cookie is the OTPortRef
  547. }
  548.     kOTPortDisabled                = $25000001;                    {  Port is now disabled                     }
  549.     kOTPortEnabled                = $25000002;                    {  Port is now enabled                     }
  550.     kOTPortOffline                = $25000003;                    {  Port is now offline                     }
  551.     kOTPortOnline                = $25000004;                    {  Port is now online                     }
  552.  
  553. {
  554.      * result is a reason for the close request, cookie is a pointer to the 
  555.      * OTPortCloseStruct structure.
  556. }
  557.     kOTClosePortRequest            = $25000005;                    {  Request to close/yield                 }
  558.     kOTYieldPortRequest            = $25000005;                    {  Request to close/yield                 }
  559.  
  560. {
  561.      * A new port has been registered, cookie is the OTPortRef
  562. }
  563.     kOTNewPortRegistered        = $25000006;                    {  New port has been registered             }
  564.  
  565. {
  566.      * These are events sent to the configuration management infrastructure 
  567. }
  568.     kOTConfigurationChanged        = $26000001;                    {  Protocol configuration changed         }
  569.     kOTSystemSleep                = $26000002;
  570.     kOTSystemShutdown            = $26000003;
  571.     kOTSystemAwaken                = $26000004;
  572.     kOTSystemIdle                = $26000005;
  573.     kOTSystemSleepPrep            = $26000006;
  574.     kOTSystemShutdownPrep        = $26000007;
  575.     kOTSystemAwakenPrep            = $26000008;
  576.  
  577. {
  578.     -------------------------------------------------------------------------
  579.     Signals that are generated by a stream.  Add these values to
  580.     kSIGNALEVENT to determine what event you are receiving.
  581.     ------------------------------------------------------------------------- 
  582. }
  583.     SIGHUP                        = 1;
  584.     SIGURG                        = 16;
  585.     SIGPOLL                        = 30;
  586.  
  587. {
  588.     -------------------------------------------------------------------------
  589.     Option Management equates
  590.     ------------------------------------------------------------------------- 
  591. }
  592. {
  593.     ** The XTI Level number of a protocol
  594. }
  595.  
  596. TYPE
  597.     OTXTILevel                            = UInt32;
  598.  
  599. CONST
  600.     XTI_GENERIC                    = $FFFF;                        {  level to match any protocol     }
  601.  
  602. {
  603.     ** The XTI name of a protocol option
  604. }
  605.  
  606. TYPE
  607.     OTXTIName                            = UInt32;
  608. {
  609.          * XTI names for options used with XTI_GENERIC above
  610. }
  611.  
  612. CONST
  613.     XTI_DEBUG                    = $0001;
  614.     XTI_LINGER                    = $0080;
  615.     XTI_RCVBUF                    = $1002;
  616.     XTI_RCVLOWAT                = $1004;
  617.     XTI_SNDBUF                    = $1001;
  618.     XTI_SNDLOWAT                = $1003;
  619.     XTI_PROTOTYPE                = $1005;
  620.  
  621. {
  622.          * Generic options that can be used with any protocol
  623.          * that understands them
  624. }
  625.     OPT_CHECKSUM                = $0600;                        {  Set checksumming = UInt32 - 0 or 1) }
  626.     OPT_RETRYCNT                = $0601;                        {  Set a retry counter = UInt32 (0 = infinite) }
  627.     OPT_INTERVAL                = $0602;                        {  Set a retry interval = UInt32 milliseconds }
  628.     OPT_ENABLEEOM                = $0603;                        {  Enable the EOM indication = UInt8 (0 or 1) }
  629.     OPT_SELFSEND                = $0604;                        {  Enable Self-sending on broadcasts = UInt32 (0 or 1) }
  630.     OPT_SERVERSTATUS            = $0605;                        {  Set Server Status (format is proto dependent) }
  631.     OPT_ALERTENABLE                = $0606;                        {  Enable/Disable protocol alerts }
  632.     OPT_KEEPALIVE                = $0008;                        {  See t_keepalive structure }
  633.  
  634. {
  635. ******************************************************************************
  636. ** Definitions not associated with a Typedef
  637. *******************************************************************************
  638. }
  639. {
  640.     -------------------------------------------------------------------------
  641.     IOCTL values for the OpenTransport system
  642.     ------------------------------------------------------------------------- 
  643. }
  644.     MIOC_STREAMIO                = 65;                            {  Basic Stream ioctl() cmds - I_PUSH, I_LOOK, etc.  }
  645.     MIOC_STRLOG                    = 98;                            {  ioctl's for Mentat's log device  }
  646.     MIOC_SAD                    = 103;                            {  ioctl's for Mentat's sad module  }
  647.     MIOC_ARP                    = 104;                            {  ioctl's for Mentat's arp module  }
  648.     MIOC_TCP                    = 107;                            {  tcp.h ioctl's  }
  649.     MIOC_DLPI                    = 108;                            {  dlpi.h additions  }
  650.     MIOC_OT                        = 79;                            {  ioctls for Open Transport     }
  651.     MIOC_ATALK                    = 84;                            {  ioctl's for AppleTalk     }
  652.     MIOC_SRL                    = 85;                            {  ioctl's for Serial         }
  653.     MIOC_SRL_HIGH                = $5500;                        {  ioctls for Serial            'U' << 8  }
  654.     MIOC_OT_HIGH                = $4F00;                        {  ioctls for Open Transport    'O' << 8  }
  655.     MIOC_SIO_HIGH                = $4100;                        {  ioctls for StreamIO            'A' << 8  }
  656.     MIOC_CFIG                    = 122;                            {  ioctl's for private configuration  }
  657.  
  658.     I_STR                        = $4108;
  659.     I_FIND                        = $410B;
  660.     I_LIST                        = $4116;
  661.     I_OTGetMiscellaneousEvents    = $4F01;                        {  sign up for Misc Events                     }
  662.     I_OTSetFramingType            = $4F02;                        {  Set framing option for link                 }
  663.     kOTGetFramingValue            = $FFFFFFFF;                    {  Use this value to read framing             }
  664.     I_OTSetRawMode                = $4F03;                        {  Set raw mode for link                     }
  665.     I_OTConnect                    = $4F04;                        {  Generic connect request for links         }
  666.     I_OTDisconnect                = $4F05;                        {  Generic disconnect request for links         }
  667.     I_OTScript                    = $4F06;                        {  Send a script to a module                 }
  668.  
  669. {
  670.      * Structure for the I_OTScript Ioctl.
  671. }
  672.  
  673. TYPE
  674.     OTScriptInfoPtr = ^OTScriptInfo;
  675.     OTScriptInfo = RECORD
  676.         fScriptType:            UInt32;
  677.         fTheScript:                Ptr;
  678.         fScriptLength:            UInt32;
  679.     END;
  680.  
  681. {
  682.      * structure of ioctl data for I_STR IOCtls
  683. }
  684.     strioctlPtr = ^strioctl;
  685.     strioctl = RECORD
  686.         ic_cmd:                    int_t;                                    {  downstream command     }
  687.         ic_timout:                int_t;                                    {  ACK/NAK timeout         }
  688.         ic_len:                    int_t;                                    {  length of data arg     }
  689.         ic_dp:                    CStringPtr;                                {  ptr to data arg         }
  690.     END;
  691.  
  692. {
  693.     -------------------------------------------------------------------------
  694.     Maximum size of a provider name, and maximum size of a STREAM module name.
  695.     This module name is smaller than the maximum size of a TProvider to allow
  696.     for 4 characters of extra "minor number" information that might be 
  697.     potentially in a TProvider name
  698.     ------------------------------------------------------------------------- 
  699. }
  700.  
  701. CONST
  702.     kMaxModuleNameLength        = 31;
  703.     kMaxModuleNameSize            = 32;
  704.     kMaxProviderNameLength        = 35;
  705.     kMaxProviderNameSize        = 36;
  706.     kMaxSlotIDLength            = 7;
  707.     kMaxSlotIDSize                = 8;
  708.     kMaxResourceInfoLength        = 31;
  709.     kMaxResourceInfoSize        = 32;
  710.  
  711. {
  712.     -------------------------------------------------------------------------
  713.     These values are used in the "fields" parameter of the OTAlloc call
  714.     to define which fields of the structure should be allocated.
  715.     ------------------------------------------------------------------------- 
  716. }
  717.     T_ADDR                        = $01;
  718.     T_OPT                        = $02;
  719.     T_UDATA                        = $04;
  720.     T_ALL                        = $FFFF;
  721.  
  722. {
  723.     -------------------------------------------------------------------------
  724.     These are the potential values returned by OTGetEndpointState and OTSync
  725.     which represent the state of an endpoint
  726.     ------------------------------------------------------------------------- 
  727. }
  728.     T_UNINIT                    = 0;                            {  addition to standard xti.h     }
  729.     T_UNBND                        = 1;                            {  unbound                         }
  730.     T_IDLE                        = 2;                            {  idle                             }
  731.     T_OUTCON                    = 3;                            {  outgoing connection pending     }
  732.     T_INCON                        = 4;                            {  incoming connection pending     }
  733.     T_DATAXFER                    = 5;                            {  data transfer                 }
  734.     T_OUTREL                    = 6;                            {  outgoing orderly release         }
  735.     T_INREL                        = 7;                            {  incoming orderly release         }
  736.  
  737. {
  738.     -------------------------------------------------------------------------
  739.     Flags used by option management calls to request services
  740.     ------------------------------------------------------------------------- 
  741. }
  742.     T_NEGOTIATE                    = $0004;
  743.     T_CHECK                        = $0008;
  744.     T_DEFAULT                    = $0010;
  745.     T_CURRENT                    = $0080;
  746.  
  747. {
  748.     -------------------------------------------------------------------------
  749.     Flags used by option management calls to return results
  750.     ------------------------------------------------------------------------- 
  751. }
  752.     T_SUCCESS                    = $0020;
  753.     T_FAILURE                    = $0040;
  754.     T_PARTSUCCESS                = $0100;
  755.     T_READONLY                    = $0200;
  756.     T_NOTSUPPORT                = $0400;
  757.  
  758. {
  759.     -------------------------------------------------------------------------
  760.     General definitions
  761.     ------------------------------------------------------------------------- 
  762. }
  763.     T_YES                        = 1;
  764.     T_NO                        = 0;
  765.     T_UNUSED                    = -1;
  766.     T_NULL                        = 0;
  767.     T_ABSREQ                    = $8000;
  768.  
  769. {
  770.     -------------------------------------------------------------------------
  771.     Option Management definitions
  772.     ------------------------------------------------------------------------- 
  773. }
  774.     T_UNSPEC                    = $FFFFFFFD;
  775.     T_ALLOPT                    = 0;
  776.  
  777. {
  778.  This macro will align return the value of "len", rounded up to the next
  779.  4-byte boundary.
  780. }
  781. {
  782.  This macro will return the next option in the buffer, given the previous option
  783.  in the buffer, returning NULL if there are no more.
  784.  You start off by setting prevOption = (TOption*)theBuffer
  785.  (Use OTNextOption for a more thorough check - it ensures the end
  786.   of the option is in the buffer as well.)
  787. }
  788. {
  789. ******************************************************************************
  790. ** Structures and forward declarations
  791. **
  792. ** From here on down, all structures are aligned the same on 68K and powerpc
  793. *******************************************************************************
  794. }
  795. {
  796.     -------------------------------------------------------------------------
  797.     OTConfiguration structure - this is a "black box" structure used to
  798.     define the configuration of a provider or endpoint.
  799.     ------------------------------------------------------------------------- 
  800. }
  801.  
  802. TYPE
  803.     OTConfigurationPtr = ^OTConfiguration;
  804.     OTConfiguration = RECORD
  805.     END;
  806.  
  807. {
  808.     -------------------------------------------------------------------------
  809.     Option Management structures
  810.     ------------------------------------------------------------------------- 
  811. }
  812. {
  813.      * Structure used with OPT_KEEPALIVE option.
  814. }
  815.     t_kpalivePtr = ^t_kpalive;
  816.     t_kpalive = RECORD
  817.         kp_onoff:                LONGINT;                                {  option on/off         }
  818.         kp_timeout:                LONGINT;                                {  timeout in minutes     }
  819.     END;
  820.  
  821. {
  822.      * Structure used with XTI_LINGER option
  823. }
  824.     t_lingerPtr = ^t_linger;
  825.     t_linger = RECORD
  826.         l_onoff:                LONGINT;                                {  option on/off  }
  827.         l_linger:                LONGINT;                                {  linger time  }
  828.     END;
  829.  
  830. {
  831.     -------------------------------------------------------------------------
  832.     TEndpointInfo - this structure is returned from the GetEndpointInfo call
  833.     and contains information about an endpoint
  834.     ------------------------------------------------------------------------- 
  835. }
  836.     TEndpointInfoPtr = ^TEndpointInfo;
  837.     TEndpointInfo = RECORD
  838.         addr:                    SInt32;                                    {  Maximum size of an address             }
  839.         options:                SInt32;                                    {  Maximum size of options                 }
  840.         tsdu:                    SInt32;                                    {  Standard data transmit unit size         }
  841.         etsdu:                    SInt32;                                    {  Expedited data transmit unit size     }
  842.         connect:                SInt32;                                    {  Maximum data size on connect             }
  843.         discon:                    SInt32;                                    {  Maximum data size on disconnect         }
  844.         servtype:                UInt32;                                    {  service type (see below for values)     }
  845.         flags:                    UInt32;                                    {  Flags (see below for values)             }
  846.     END;
  847.  
  848. {
  849.      * Values returned in servtype field of TEndpointInfo
  850. }
  851.  
  852. CONST
  853.     T_COTS                        = 1;                            {  Connection-mode service                                 }
  854.     T_COTS_ORD                    = 2;                            {  Connection service with orderly release                 }
  855.     T_CLTS                        = 3;                            {  Connectionless-mode service                             }
  856.     T_TRANS                        = 5;                            {  Connection-mode transaction service                     }
  857.     T_TRANS_ORD                    = 6;                            {  Connection transaction service with orderly release     }
  858.     T_TRANS_CLTS                = 7;                            {  Connectionless transaction service                     }
  859.  
  860. {
  861.      * Values returned in flags field of TEndpointInfo
  862. }
  863.     T_SENDZERO                    = $0001;                        {  supports 0-length TSDU's             }
  864.     T_XPG4_1                    = $0002;                        {  supports the GetProtAddress call     }
  865.     T_CAN_SUPPORT_MDATA            = $10000000;                    {  support M_DATAs on packet protocols     }
  866.     T_CAN_RESOLVE_ADDR            = $40000000;                    {  Supports ResolveAddress call             }
  867.     T_CAN_SUPPLY_MIB            = $20000000;                    {  Supports SNMP MIB data                 }
  868.  
  869. {
  870.      * Values returned in tsdu, etsdu, connect, and discon fields of TEndpointInfo
  871. }
  872.     T_INFINITE                    = -1;                            {  supports infinit amounts of data         }
  873.     T_INVALID                    = -2;                            {  Does not support data transmission     }
  874.  
  875. {
  876.     -------------------------------------------------------------------------
  877.     OTPortRecord
  878.     ------------------------------------------------------------------------- 
  879. }
  880. {
  881.      * Unique identifier for a port
  882. }
  883.  
  884. TYPE
  885.     OTPortRef                            = UInt32;
  886.     OTPortRefPtr                        = ^OTPortRef;
  887. {
  888.      * A couple of special values for the "port type" in an OTPortRef.
  889.      * See OpenTptLinks.h for other values.
  890.      * The device kOTPseudoDevice is used where no other defined
  891.      * device type will work.
  892. }
  893.  
  894. CONST
  895.     kOTNoDeviceType                = 0;
  896.     kOTPseudoDevice                = 1023;
  897.     kOTLastDeviceIndex            = 1022;
  898.     kOTLastSlotNumber            = 255;
  899.     kOTLastOtherNumber            = 255;
  900.  
  901. {
  902.      * kMaxPortNameLength is the maximum size allowed to define
  903.      * a port
  904. }
  905.     kMaxPortNameLength            = 35;
  906.     kMaxPortNameSize            = 36;
  907.  
  908.     kOTInvalidPortRef            = 0;
  909.  
  910. {
  911.      * Equates for the legal Bus-type values
  912. }
  913.     kOTUnknownBusPort            = 0;
  914.     kOTMotherboardBus            = 1;
  915.     kOTNuBus                    = 2;
  916.     kOTPCIBus                    = 3;
  917.     kOTGeoPort                    = 4;
  918.     kOTPCCardBus                = 5;
  919.     kOTFireWireBus                = 6;
  920.     kOTLastBusIndex                = 15;
  921.  
  922.  
  923. TYPE
  924.     OTPortCloseStructPtr = ^OTPortCloseStruct;
  925.     OTPortCloseStruct = RECORD
  926.         fPortRef:                OTPortRef;                                {  The port requested to be closed. }
  927.         fTheProvider:            ProviderRef;                            {  The provider using the port. }
  928.         fDenyReason:            OSStatus;                                {  Set to a negative number to deny the request }
  929.     END;
  930.  
  931. FUNCTION OTCreatePortRef(busType: ByteParameter; devType: UInt16; slot: UInt16; other: UInt16): OTPortRef;
  932. FUNCTION OTGetDeviceTypeFromPortRef(ref: OTPortRef): UInt16;
  933. FUNCTION OTGetBusTypeFromPortRef(ref: OTPortRef): UInt16;
  934. FUNCTION OTGetSlotFromPortRef(ref: OTPortRef; VAR other: UInt16): UInt16;
  935. FUNCTION OTSetDeviceTypeInPortRef(ref: OTPortRef; devType: UInt16): OTPortRef;
  936. FUNCTION OTSetBusTypeInPortRef(ref: OTPortRef; busType: ByteParameter): OTPortRef;
  937. {
  938.      * One OTPortRecord is created for each instance of a port.
  939.      * For Instance 'enet' identifies an ethernet port.
  940.      * A TPortRecord for each ethernet card it finds, with an
  941.      * OTPortRef that will uniquely allow the driver to determine which
  942.      * port it is supposed to open on.
  943. }
  944.  
  945. TYPE
  946.     OTPortRecordPtr = ^OTPortRecord;
  947.     OTPortRecord = RECORD
  948.         fRef:                    OTPortRef;
  949.         fPortFlags:                UInt32;
  950.         fInfoFlags:                UInt32;
  951.         fCapabilities:            UInt32;
  952.         fNumChildPorts:            size_t;
  953.         fChildPorts:            OTPortRefPtr;
  954.         fPortName:                PACKED ARRAY [0..35] OF CHAR;
  955.         fModuleName:            PACKED ARRAY [0..31] OF CHAR;
  956.         fSlotID:                PACKED ARRAY [0..7] OF CHAR;
  957.         fResourceInfo:            PACKED ARRAY [0..31] OF CHAR;
  958.         fReserved:                PACKED ARRAY [0..163] OF CHAR;
  959.     END;
  960.  
  961. {
  962.      * Values for the fInfoFlags field of OTPortRecord
  963.      * kOTPortCanYield and kOTPortCanArbitrate
  964.      * will not be set until the port is used for the first time.
  965. }
  966.  
  967. CONST
  968.     kOTPortIsDLPI                = $00000001;
  969.     kOTPortIsTPI                = $00000002;
  970.     kOTPortCanYield                = $00000004;
  971.     kOTPortCanArbitrate            = $00000008;
  972.     kOTPortIsTransitory            = $00000010;
  973.     kOTPortAutoConnects            = $00000020;
  974.     kOTPortIsSystemRegistered    = $00004000;
  975.     kOTPortIsPrivate            = $00008000;
  976.     kOTPortIsAlias                = $80000000;
  977.  
  978. {
  979.      * Values for the fPortFlags field of TPortRecord
  980.      * If no bits are set, the port is currently inactive.
  981. }
  982.     kOTPortIsActive                = $00000001;
  983.     kOTPortIsDisabled            = $00000002;
  984.     kOTPortIsUnavailable        = $00000004;
  985.     kOTPortIsOffline            = $00000008;
  986.  
  987. {
  988.     -------------------------------------------------------------------------
  989.     TOptionHeader and TOption
  990.     
  991.     This structure describes the contents of a single option in a buffer
  992.     ------------------------------------------------------------------------- 
  993. }
  994.  
  995. TYPE
  996.     TOptionHeaderPtr = ^TOptionHeader;
  997.     TOptionHeader = RECORD
  998.         len:                    UInt32;                                    {  total length of option                 }
  999.                                                                         {  = sizeof(TOptionHeader) + length         }
  1000.                                                                         {      of option value in bytes             }
  1001.         level:                    OTXTILevel;                                {  protocol affected                     }
  1002.         optName:                OTXTIName;                                {  option name                             }
  1003.         status:                    UInt32;                                    {  status value                             }
  1004.     END;
  1005.  
  1006.     TOptionPtr = ^TOption;
  1007.     TOption = RECORD
  1008.         len:                    UInt32;                                    {  total length of option                 }
  1009.                                                                         {  = sizeof(TOption) + length     }
  1010.                                                                         {      of option value in bytes             }
  1011.         level:                    OTXTILevel;                                {  protocol affected                     }
  1012.         optName:                OTXTIName;                                {  option name                             }
  1013.         status:                    UInt32;                                    {  status value                             }
  1014.         value:                    ARRAY [0..0] OF UInt32;                    {  data goes here                         }
  1015.     END;
  1016.  
  1017.  
  1018. CONST
  1019.     kOTOptionHeaderSize            = 16;
  1020.     kOTBooleanOptionDataSize    = 4;
  1021.     kOTBooleanOptionSize        = 20;
  1022.     kOTOneByteOptionSize        = 17;
  1023.     kOTTwoByteOptionSize        = 18;
  1024.     kOTFourByteOptionSize        = 20;
  1025.  
  1026. {
  1027.     -------------------------------------------------------------------------
  1028.     PollRef structure
  1029.     
  1030.     This is used with the OTStreamPoll function
  1031.     ------------------------------------------------------------------------- 
  1032. }
  1033.  
  1034. TYPE
  1035.     PollRefPtr = ^PollRef;
  1036.     PollRef = RECORD
  1037.         filler:                    LONGINT;
  1038.         events:                    INTEGER;
  1039.         revents:                INTEGER;
  1040.         ref:                    StreamRef;
  1041.     END;
  1042.  
  1043. {
  1044.     -------------------------------------------------------------------------
  1045.     OTClientList structure
  1046.     
  1047.     This is used with the OTYieldPortRequest function.
  1048.     ------------------------------------------------------------------------- 
  1049. }
  1050.     OTClientListPtr = ^OTClientList;
  1051.     OTClientList = RECORD
  1052.         fNumClients:            size_t;
  1053.         fBuffer:                PACKED ARRAY [0..3] OF UInt8;
  1054.     END;
  1055.  
  1056. {
  1057.     -------------------------------------------------------------------------
  1058.     OTData
  1059.     
  1060.     This is a structure that may be used in a TNetbuf or netbuf to send
  1061.     non-contiguous data.  Set the 'len' field of the netbuf to the
  1062.     constant kNetbufDataIsOTData to signal that the 'buf' field of the
  1063.     netbuf actually points to one of these structures instead of a
  1064.     memory buffer.
  1065.     ------------------------------------------------------------------------- 
  1066. }
  1067.     OTDataPtr = ^OTData;
  1068.     OTData = RECORD
  1069.         fNext:                    Ptr;
  1070.         fData:                    Ptr;
  1071.         fLen:                    size_t;
  1072.     END;
  1073.  
  1074.  
  1075. CONST
  1076.     kNetbufDataIsOTData            = $FFFFFFFE;
  1077.  
  1078. {
  1079.     -------------------------------------------------------------------------
  1080.     OTBuffer
  1081.  
  1082.     This is the structure that is used for no-copy receives.
  1083.     When you are done with it, you must call the OTReleaseBuffer function.
  1084.     For best performance, you need to call OTReleaseBuffer quickly.  Only
  1085.     data netbufs may use this - no netbufs for addresses or options, or the like.
  1086.     ------------------------------------------------------------------------- 
  1087. }
  1088.  
  1089. TYPE
  1090.     OTBufferPtr = ^OTBuffer;
  1091.     OTBuffer = RECORD
  1092.         fLink:                    Ptr;                                    {  b_next & b_prev }
  1093.         fLink2:                    Ptr;
  1094.         fNext:                    OTBufferPtr;                            {  b_cont }
  1095.         fData:                    Ptr;                                    {  b_rptr }
  1096.         fLen:                    size_t;                                    {  b_wptr }
  1097.         fSave:                    Ptr;                                    {  b_datap }
  1098.         fBand:                    SInt8;                                    {  b_band }
  1099.         fType:                    SInt8;                                    {  b_pad1 }
  1100.         fPad1:                    SInt8;
  1101.         fFlags:                    SInt8;                                    {  b_flag }
  1102.     END;
  1103.  
  1104. {
  1105.     -------------------------------------------------------------------------
  1106.     OTBufferInfo
  1107.     
  1108.     This structure is used with OTReadBuffer to keep track of where you
  1109.     are in the buffer, since the OTBuffer is "read-only".
  1110.     ------------------------------------------------------------------------- 
  1111. }
  1112.     OTBufferInfoPtr = ^OTBufferInfo;
  1113.     OTBufferInfo = RECORD
  1114.         fBuffer:                OTBufferPtr;
  1115.         fOffset:                size_t;
  1116.         fPad:                    SInt8;
  1117.         fFiller:                SInt8;
  1118.     END;
  1119.  
  1120.  
  1121. CONST
  1122.     kOTNetbufDataIsOTBufferStar    = $FFFFFFFD;
  1123.  
  1124. {
  1125.     -------------------------------------------------------------------------
  1126.     kOTNetbufIsRawMode
  1127.     
  1128.     If the endpoint supports "raw mode" (the T_CAN_SUPPORT_MDATA bit will
  1129.     be set in the TEndpointInfo::flags field), then you specify the
  1130.     raw mode packet by putting the kOTNetbufIsRawMode value in
  1131.     the udata.addr.len field when calling OTSndUData and also set the
  1132.     udata.opt.len, udata.opt.buf, and udata.addr.buf fields to 0.
  1133.     ------------------------------------------------------------------------- 
  1134. }
  1135.  
  1136. CONST
  1137.     kOTNetbufIsRawMode    = $FFFFFFFF;
  1138.  
  1139. {
  1140.     -------------------------------------------------------------------------
  1141.     TNetbuf
  1142.     
  1143.     This structure is the basic structure used to pass data back and forth
  1144.     between the Open Transport protocols and their clients
  1145.     ------------------------------------------------------------------------- 
  1146. }
  1147.  
  1148. TYPE
  1149.     TNetbufPtr = ^TNetbuf;
  1150.     TNetbuf = RECORD
  1151.         maxlen:                    size_t;
  1152.         len:                    size_t;
  1153.         buf:                    Ptr;
  1154.     END;
  1155.  
  1156. {
  1157.     -------------------------------------------------------------------------
  1158.     TBind
  1159.     
  1160.     Structure passed to GetProtAddress, ResolveAddress and Bind
  1161.     ------------------------------------------------------------------------- 
  1162. }
  1163.     TBindPtr = ^TBind;
  1164.     TBind = RECORD
  1165.         addr:                    TNetbuf;
  1166.         qlen:                    OTQLen;
  1167.     END;
  1168.  
  1169. {
  1170.     -------------------------------------------------------------------------
  1171.     TDiscon
  1172.     
  1173.     Structure passed to RcvDisconnect to find out additional information
  1174.     about the disconnect
  1175.     ------------------------------------------------------------------------- 
  1176. }
  1177.     TDisconPtr = ^TDiscon;
  1178.     TDiscon = RECORD
  1179.         udata:                    TNetbuf;
  1180.         reason:                    OTReason;
  1181.         sequence:                OTSequence;
  1182.     END;
  1183.  
  1184. {
  1185.     -------------------------------------------------------------------------
  1186.     TCall
  1187.     
  1188.     Structure passed to Connect, RcvConnect, Listen, Accept, and
  1189.     SndDisconnect to describe the connection.
  1190.     ------------------------------------------------------------------------- 
  1191. }
  1192.     TCallPtr = ^TCall;
  1193.     TCall = RECORD
  1194.         addr:                    TNetbuf;
  1195.         opt:                    TNetbuf;
  1196.         udata:                    TNetbuf;
  1197.         sequence:                OTSequence;
  1198.     END;
  1199.  
  1200. {
  1201.     -------------------------------------------------------------------------
  1202.     TUnitData
  1203.     
  1204.     Structure passed to SndUData and RcvUData to describe the datagram
  1205.     ------------------------------------------------------------------------- 
  1206. }
  1207.     TUnitDataPtr = ^TUnitData;
  1208.     TUnitData = RECORD
  1209.         addr:                    TNetbuf;
  1210.         opt:                    TNetbuf;
  1211.         udata:                    TNetbuf;
  1212.     END;
  1213.  
  1214. {
  1215.     -------------------------------------------------------------------------
  1216.     TUDErr
  1217.     
  1218.     Structure passed to RcvUDErr to find out about a datagram error
  1219.     ------------------------------------------------------------------------- 
  1220. }
  1221.     TUDErrPtr = ^TUDErr;
  1222.     TUDErr = RECORD
  1223.         addr:                    TNetbuf;
  1224.         opt:                    TNetbuf;
  1225.         error:                    SInt32;
  1226.     END;
  1227.  
  1228. {
  1229.     -------------------------------------------------------------------------
  1230.     TOptMgmt
  1231.     
  1232.     Structure passed to the OptionManagement call to read or set protocol
  1233.     options.
  1234.     ------------------------------------------------------------------------- 
  1235. }
  1236.     TOptMgmtPtr = ^TOptMgmt;
  1237.     TOptMgmt = RECORD
  1238.         opt:                    TNetbuf;
  1239.         flags:                    OTFlags;
  1240.     END;
  1241.  
  1242. {
  1243.     -------------------------------------------------------------------------
  1244.     TRequest
  1245.     
  1246.     Structure passed to SndRequest and RcvRequest that contains the information
  1247.     about the request
  1248.     ------------------------------------------------------------------------- 
  1249. }
  1250.     TRequestPtr = ^TRequest;
  1251.     TRequest = RECORD
  1252.         data:                    TNetbuf;
  1253.         opt:                    TNetbuf;
  1254.         sequence:                OTSequence;
  1255.     END;
  1256.  
  1257. {
  1258.     -------------------------------------------------------------------------
  1259.     TReply
  1260.     
  1261.     Structure passed to SndReply to send a reply to an incoming request
  1262.     ------------------------------------------------------------------------- 
  1263. }
  1264.     TReplyPtr = ^TReply;
  1265.     TReply = RECORD
  1266.         data:                    TNetbuf;
  1267.         opt:                    TNetbuf;
  1268.         sequence:                OTSequence;
  1269.     END;
  1270.  
  1271. {
  1272.     -------------------------------------------------------------------------
  1273.     TUnitRequest
  1274.     
  1275.     Structure passed to SndURequest and RcvURequest that contains the information
  1276.     about the request
  1277.     ------------------------------------------------------------------------- 
  1278. }
  1279.     TUnitRequestPtr = ^TUnitRequest;
  1280.     TUnitRequest = RECORD
  1281.         addr:                    TNetbuf;
  1282.         opt:                    TNetbuf;
  1283.         udata:                    TNetbuf;
  1284.         sequence:                OTSequence;
  1285.     END;
  1286.  
  1287. {
  1288.     -------------------------------------------------------------------------
  1289.     TUnitReply
  1290.     
  1291.     Structure passed to SndUReply to send a reply to an incoming request
  1292.     ------------------------------------------------------------------------- 
  1293. }
  1294.     TUnitReplyPtr = ^TUnitReply;
  1295.     TUnitReply = RECORD
  1296.         opt:                    TNetbuf;
  1297.         udata:                    TNetbuf;
  1298.         sequence:                OTSequence;
  1299.     END;
  1300.  
  1301. {
  1302.     -------------------------------------------------------------------------
  1303.     TRegisterRequest
  1304.     ------------------------------------------------------------------------- 
  1305. }
  1306.     TRegisterRequestPtr = ^TRegisterRequest;
  1307.     TRegisterRequest = RECORD
  1308.         name:                    TNetbuf;
  1309.         addr:                    TNetbuf;
  1310.         flags:                    OTFlags;
  1311.     END;
  1312.  
  1313. {
  1314.     -------------------------------------------------------------------------
  1315.     TRegisterReply
  1316.     ------------------------------------------------------------------------- 
  1317. }
  1318.     TRegisterReplyPtr = ^TRegisterReply;
  1319.     TRegisterReply = RECORD
  1320.         addr:                    TNetbuf;
  1321.         nameid:                    OTNameID;
  1322.     END;
  1323.  
  1324. {
  1325.     -------------------------------------------------------------------------
  1326.     TLookupRequest
  1327.     ------------------------------------------------------------------------- 
  1328. }
  1329.     TLookupRequestPtr = ^TLookupRequest;
  1330.     TLookupRequest = RECORD
  1331.         name:                    TNetbuf;
  1332.         addr:                    TNetbuf;
  1333.         maxcnt:                    UInt32;
  1334.         timeout:                OTTimeout;
  1335.         flags:                    OTFlags;
  1336.     END;
  1337.  
  1338. {
  1339.     -------------------------------------------------------------------------
  1340.     TLookupReply 
  1341.     
  1342.     Structure used by Mapper protocols to return the results of name Lookups
  1343.     ------------------------------------------------------------------------- 
  1344. }
  1345. {
  1346.      * This is the structure returned by the mapper for names that are
  1347.      * looked up.  
  1348. }
  1349.     TLookupBufferPtr = ^TLookupBuffer;
  1350.     TLookupBuffer = RECORD
  1351.         fAddressLength:            UInt16;
  1352.         fNameLength:            UInt16;
  1353.         fAddressBuffer:            SInt8;
  1354.     END;
  1355.  
  1356.     TLookupReplyPtr = ^TLookupReply;
  1357.     TLookupReply = RECORD
  1358.         names:                    TNetbuf;
  1359.         rspcount:                UInt32;
  1360.     END;
  1361.  
  1362. {
  1363. ******************************************************************************
  1364. ** C Interfaces to Open Transport
  1365. *******************************************************************************
  1366. }
  1367. {
  1368.     -------------------------------------------------------------------------
  1369.     Initializing and shutting down Open Transport
  1370.     ------------------------------------------------------------------------- 
  1371. }
  1372. {$IFC NOT OTKERNEL }
  1373. FUNCTION InitOpenTransport: OSStatus;
  1374. FUNCTION InitOpenTransportUtilities: OSStatus;
  1375. PROCEDURE CloseOpenTransport;
  1376. {
  1377.  This registers yourself as a client for any miscellaneous Open Transport
  1378.  notifications that come along. CloseOpenTransport will automatically do
  1379.  an OTUnregisterAsClient, if you have not already done so.
  1380. }
  1381. FUNCTION OTRegisterAsClient(name: OTClientName; proc: OTNotifyProcPtr): OSStatus;
  1382. FUNCTION OTUnregisterAsClient: OSStatus;
  1383. {$ENDC}
  1384. {
  1385.     -------------------------------------------------------------------------
  1386.     Interrupt processing
  1387.     
  1388.     These routine must be used by interrupt, deferred task, vbl, and time
  1389.     manager routines to bracket any calls to OpenTransport.
  1390.     ------------------------------------------------------------------------- 
  1391. }
  1392. PROCEDURE OTEnterInterrupt;
  1393. PROCEDURE OTLeaveInterrupt;
  1394.  
  1395. TYPE
  1396.     OTProcessProcPtr = ProcPtr;  { PROCEDURE OTProcess(arg: UNIV Ptr); }
  1397.  
  1398. FUNCTION OTCreateDeferredTask(proc: OTProcessProcPtr; arg: UNIV Ptr): LONGINT;
  1399. FUNCTION OTScheduleDeferredTask(dtCookie: LONGINT): BOOLEAN;
  1400. FUNCTION OTScheduleInterruptTask(dtCookie: LONGINT): BOOLEAN;
  1401. FUNCTION OTDestroyDeferredTask(dtCookie: LONGINT): OSStatus;
  1402. {$IFC NOT OTKERNEL }
  1403. FUNCTION OTCreateSystemTask(proc: OTProcessProcPtr; arg: UNIV Ptr): LONGINT;
  1404. FUNCTION OTDestroySystemTask(stCookie: LONGINT): OSStatus;
  1405. FUNCTION OTScheduleSystemTask(stCookie: LONGINT): BOOLEAN;
  1406. FUNCTION OTCancelSystemTask(stCookie: LONGINT): BOOLEAN;
  1407. FUNCTION OTCanMakeSyncCall: BOOLEAN;
  1408. {$ENDC}
  1409. FUNCTION OTIsAtInterruptLevel: BOOLEAN; C;
  1410. FUNCTION OTCanLoadLibraries: BOOLEAN; C;
  1411. {
  1412.     -------------------------------------------------------------------------
  1413.     Functions for dealing with port
  1414.     ------------------------------------------------------------------------- 
  1415. }
  1416. {$IFC NOT OTKERNEL }
  1417. FUNCTION OTGetIndexedPort(VAR record1: OTPortRecord; index: size_t): BOOLEAN;
  1418. FUNCTION OTFindPort(VAR record1: OTPortRecord; portName: ConstCStringPtr): BOOLEAN;
  1419. FUNCTION OTFindPortByRef(VAR record1: OTPortRecord; ref: OTPortRef): BOOLEAN;
  1420. FUNCTION OTRegisterPort(VAR portInfo: OTPortRecord; ref: UNIV Ptr): OSStatus; C;
  1421. FUNCTION OTUnregisterPort(portName: ConstCStringPtr; VAR cookiePtrPTr: UNIV Ptr): OSStatus; C;
  1422. FUNCTION OTChangePortState(ref: OTPortRef; theChange: OTEventCode; why: OTResult): OSStatus; C;
  1423. {$ENDC}
  1424. {
  1425.     -------------------------------------------------------------------------
  1426.     Interface to providers
  1427.     ------------------------------------------------------------------------- 
  1428. }
  1429.  
  1430. TYPE
  1431.     strbufPtr = ^strbuf;
  1432.     strbuf = RECORD
  1433.         maxlen:                    LONGINT;                                {  max buffer length  }
  1434.         len:                    LONGINT;                                {  length of data  }
  1435.         buf:                    CStringPtr;                                {  pointer to buffer  }
  1436.     END;
  1437.  
  1438. {$IFC NOT OTKERNEL }
  1439. FUNCTION OTAsyncOpenProvider(config: OTConfigurationPtr; flags: OTOpenFlags; proc: OTNotifyProcPtr; contextPtr: UNIV Ptr): OSStatus;
  1440. FUNCTION OTOpenProvider(config: OTConfigurationPtr; flags: OTOpenFlags; VAR errPtr: OSStatus): ProviderRef;
  1441. FUNCTION OTCloseProvider(ref: ProviderRef): OSStatus;
  1442. FUNCTION OTTransferProviderOwnership(ref: ProviderRef; prevOwner: OTClient; VAR errPtr: OSStatus): ProviderRef;
  1443. FUNCTION OTWhoAmI: OTClient;
  1444. FUNCTION OTGetProviderPortRef(ref: ProviderRef): OTPortRef;
  1445. FUNCTION OTIoctl(ref: ProviderRef; cmd: UInt32; data: UNIV Ptr): SInt32;
  1446. FUNCTION OTGetMessage(ref: ProviderRef; VAR ctlbuf: strbuf; VAR databuf: strbuf; VAR flagPtr: OTFlags): OTResult;
  1447. FUNCTION OTGetPriorityMessage(ref: ProviderRef; VAR ctlbuf: strbuf; VAR databuf: strbuf; VAR bandPtr: OTBand; VAR flagPtr: OTFlags): OTResult;
  1448. FUNCTION OTPutMessage(ref: ProviderRef; {CONST}VAR ctlbuf: strbuf; {CONST}VAR databuf: strbuf; flags: OTFlags): OSStatus;
  1449. FUNCTION OTPutPriorityMessage(ref: ProviderRef; {CONST}VAR ctlbuf: strbuf; {CONST}VAR databuf: strbuf; band: OTBand; flags: OTFlags): OSStatus;
  1450. FUNCTION OTSetAsynchronous(ref: ProviderRef): OSStatus;
  1451. FUNCTION OTSetSynchronous(ref: ProviderRef): OSStatus;
  1452. FUNCTION OTIsSynchronous(ref: ProviderRef): BOOLEAN;
  1453. FUNCTION OTSetBlocking(ref: ProviderRef): OSStatus;
  1454. FUNCTION OTSetNonBlocking(ref: ProviderRef): OSStatus;
  1455. FUNCTION OTIsBlocking(ref: ProviderRef): BOOLEAN;
  1456. FUNCTION OTInstallNotifier(ref: ProviderRef; proc: OTNotifyProcPtr; contextPtr: UNIV Ptr): OSStatus;
  1457. FUNCTION OTUseSyncIdleEvents(ref: ProviderRef; useEvents: BOOLEAN): OSStatus;
  1458. PROCEDURE OTRemoveNotifier(ref: ProviderRef);
  1459. PROCEDURE OTLeaveNotifier(ref: ProviderRef);
  1460. FUNCTION OTEnterNotifier(ref: ProviderRef): BOOLEAN;
  1461. FUNCTION OTAckSends(ref: ProviderRef): OSStatus;
  1462. FUNCTION OTDontAckSends(ref: ProviderRef): OSStatus;
  1463. FUNCTION OTIsAckingSends(ref: ProviderRef): BOOLEAN;
  1464. FUNCTION OTCancelSynchronousCalls(ref: ProviderRef; err: OSStatus): OSStatus;
  1465. {$ENDC}
  1466. {
  1467.     -------------------------------------------------------------------------
  1468.     Interface to endpoints
  1469.     ------------------------------------------------------------------------- 
  1470. }
  1471. {$IFC NOT OTKERNEL }
  1472. {  Open/Close }
  1473. FUNCTION OTOpenEndpoint(config: OTConfigurationPtr; oflag: OTOpenFlags; info: TEndpointInfoPtr; VAR err: OSStatus): EndpointRef;
  1474. FUNCTION OTAsyncOpenEndpoint(config: OTConfigurationPtr; oflag: OTOpenFlags; info: TEndpointInfoPtr; proc: OTNotifyProcPtr; contextPtr: UNIV Ptr): OSStatus;
  1475. {  Misc Information }
  1476. FUNCTION OTGetEndpointInfo(ref: EndpointRef; info: TEndpointInfoPtr): OSStatus;
  1477. FUNCTION OTGetEndpointState(ref: EndpointRef): OTResult;
  1478. FUNCTION OTLook(ref: EndpointRef): OTResult;
  1479. FUNCTION OTSync(ref: EndpointRef): OTResult;
  1480. FUNCTION OTCountDataBytes(ref: EndpointRef; VAR countPtr: size_t): OTResult;
  1481. FUNCTION OTGetProtAddress(ref: EndpointRef; boundAddr: TBindPtr; peerAddr: TBindPtr): OSStatus;
  1482. FUNCTION OTResolveAddress(ref: EndpointRef; reqAddr: TBindPtr; retAddr: TBindPtr; timeOut: OTTimeout): OSStatus;
  1483. {  Allocating structures }
  1484. FUNCTION OTAlloc(ref: EndpointRef; structType: OTStructType; fields: UInt32; VAR err: OSStatus): Ptr;
  1485. FUNCTION OTFree(ptr: UNIV Ptr; structType: OTStructType): OTResult;
  1486. {  Option management }
  1487. FUNCTION OTOptionManagement(ref: EndpointRef; req: TOptMgmtPtr; ret: TOptMgmtPtr): OSStatus;
  1488. {  Bind/Unbind }
  1489. FUNCTION OTBind(ref: EndpointRef; reqAddr: TBindPtr; retAddr: TBindPtr): OSStatus;
  1490. FUNCTION OTUnbind(ref: EndpointRef): OSStatus;
  1491. {  Connection creation/tear-down }
  1492. FUNCTION OTConnect(ref: EndpointRef; sndCall: TCallPtr; rcvCall: TCallPtr): OSStatus;
  1493. FUNCTION OTRcvConnect(ref: EndpointRef; call: TCallPtr): OSStatus;
  1494. FUNCTION OTListen(ref: EndpointRef; call: TCallPtr): OSStatus;
  1495. FUNCTION OTAccept(ref: EndpointRef; resRef: EndpointRef; call: TCallPtr): OSStatus;
  1496. FUNCTION OTSndDisconnect(ref: EndpointRef; call: TCallPtr): OSStatus;
  1497. FUNCTION OTSndOrderlyDisconnect(ref: EndpointRef): OSStatus;
  1498. FUNCTION OTRcvDisconnect(ref: EndpointRef; discon: TDisconPtr): OSStatus;
  1499. FUNCTION OTRcvOrderlyDisconnect(ref: EndpointRef): OSStatus;
  1500. {  Connection-oriented send/receive }
  1501. FUNCTION OTRcv(ref: EndpointRef; buf: UNIV Ptr; nbytes: size_t; VAR flags: OTFlags): OTResult;
  1502. FUNCTION OTSnd(ref: EndpointRef; buf: UNIV Ptr; nbytes: size_t; flags: OTFlags): OTResult;
  1503. {  non-connection oriented send/receive }
  1504. FUNCTION OTSndUData(ref: EndpointRef; udata: TUnitDataPtr): OSStatus;
  1505. FUNCTION OTRcvUData(ref: EndpointRef; udata: TUnitDataPtr; VAR flags: OTFlags): OSStatus;
  1506. FUNCTION OTRcvUDErr(ref: EndpointRef; uderr: TUDErrPtr): OSStatus;
  1507. {  Connection-oriented transactions }
  1508. FUNCTION OTSndRequest(ref: EndpointRef; req: TRequestPtr; reqFlags: OTFlags): OSStatus;
  1509. FUNCTION OTRcvReply(ref: EndpointRef; reply: TReplyPtr; VAR replyFlags: OTFlags): OSStatus;
  1510. FUNCTION OTSndReply(ref: EndpointRef; reply: TReplyPtr; replyFlags: OTFlags): OSStatus;
  1511. FUNCTION OTRcvRequest(ref: EndpointRef; req: TRequestPtr; VAR reqFlags: OTFlags): OSStatus;
  1512. FUNCTION OTCancelRequest(ref: EndpointRef; sequence: OTSequence): OSStatus;
  1513. FUNCTION OTCancelReply(ref: EndpointRef; sequence: OTSequence): OSStatus;
  1514. {  Connectionless transactions }
  1515. FUNCTION OTSndURequest(ref: EndpointRef; req: TUnitRequestPtr; reqFlags: OTFlags): OSStatus;
  1516. FUNCTION OTRcvUReply(ref: EndpointRef; reply: TUnitReplyPtr; VAR replyFlags: OTFlags): OSStatus;
  1517. FUNCTION OTSndUReply(ref: EndpointRef; reply: TUnitReplyPtr; replyFlags: OTFlags): OSStatus;
  1518. FUNCTION OTRcvURequest(ref: EndpointRef; req: TUnitRequestPtr; VAR reqFlags: OTFlags): OSStatus;
  1519. FUNCTION OTCancelURequest(ref: EndpointRef; seq: OTSequence): OSStatus;
  1520. FUNCTION OTCancelUReply(ref: EndpointRef; seq: OTSequence): OSStatus;
  1521. {
  1522.     -------------------------------------------------------------------------
  1523.     Interface to mappers
  1524.     ------------------------------------------------------------------------- 
  1525. }
  1526. FUNCTION OTAsyncOpenMapper(config: OTConfigurationPtr; oflag: OTOpenFlags; proc: OTNotifyProcPtr; contextPtr: UNIV Ptr): OSStatus;
  1527. FUNCTION OTOpenMapper(config: OTConfigurationPtr; oflag: OTOpenFlags; VAR err: OSStatus): MapperRef;
  1528. FUNCTION OTRegisterName(ref: MapperRef; req: TRegisterRequestPtr; VAR reply: TRegisterReply): OSStatus;
  1529. FUNCTION OTDeleteName(ref: MapperRef; name: TNetbufPtr): OSStatus;
  1530. FUNCTION OTDeleteNameByID(ref: MapperRef; nameID: OTNameID): OSStatus;
  1531. FUNCTION OTLookupName(ref: MapperRef; req: TLookupRequestPtr; reply: TLookupReplyPtr): OSStatus;
  1532. {
  1533.     -------------------------------------------------------------------------
  1534.     Miscellaneous and generic functions
  1535.     ------------------------------------------------------------------------- 
  1536. }
  1537. FUNCTION OTAllocMem(size: size_t): Ptr; C;
  1538. PROCEDURE OTFreeMem(memptr: UNIV Ptr); C;
  1539. PROCEDURE OTDelay(seconds: UInt32);
  1540. PROCEDURE OTIdle;
  1541. FUNCTION OTCreateConfiguration(path: ConstCStringPtr): OTConfigurationPtr;
  1542. FUNCTION OTCloneConfiguration(cfig: OTConfigurationPtr): OTConfigurationPtr;
  1543. PROCEDURE OTDestroyConfiguration(cfig: OTConfigurationPtr);
  1544. FUNCTION OTCreateOptions(endPtName: ConstCStringPtr; strPtr: CStringPtrPtr; VAR buf: TNetbuf): OSStatus;
  1545. FUNCTION OTCreateOptionString(endPtName: ConstCStringPtr; VAR opt: TOptionPtr; bufEnd: UNIV Ptr; strPTr: CStringPtr; stringSize: size_t): OSStatus;
  1546. FUNCTION OTNextOption(VAR buffer: UInt8; buflen: UInt32; VAR prevOptPtr: TOptionPtr): OSStatus;
  1547. FUNCTION OTFindOption(VAR buffer: UInt8; buflen: UInt32; level: OTXTILevel; name: OTXTIName): TOptionPtr;
  1548. {$ENDC}
  1549. {
  1550. ******************************************************************************
  1551. ** Open Transport Utility routines
  1552. **
  1553. ** These routines are available to both client and kernel
  1554. *******************************************************************************
  1555. }
  1556. {
  1557.     -------------------------------------------------------------------------
  1558.     ** Memory functions
  1559.     ------------------------------------------------------------------------- 
  1560. }
  1561. PROCEDURE OTMemcpy(dest: UNIV Ptr; src: UNIV Ptr; nBytes: size_t); C;
  1562. FUNCTION OTMemcmp(mem1: UNIV Ptr; mem2: UNIV Ptr; nBytes: size_t): BOOLEAN; C;
  1563. PROCEDURE OTMemmove(dest: UNIV Ptr; src: UNIV Ptr; nBytes: size_t); C;
  1564. PROCEDURE OTMemzero(dest: UNIV Ptr; nBytes: size_t); C;
  1565. PROCEDURE OTMemset(dest: UNIV Ptr; toSet: uchar_p; nBytes: size_t); C;
  1566. FUNCTION OTStrLength(strPtr: ConstCStringPtr): size_t; C;
  1567. PROCEDURE OTStrCopy(strTo: CStringPtr; strFrom: ConstCStringPtr); C;
  1568. PROCEDURE OTStrCat(strTo: CStringPtr; strFrom: ConstCStringPtr); C;
  1569. FUNCTION OTStrEqual(strPtr1: ConstCStringPtr; strPtr2: ConstCStringPtr): BOOLEAN; C;
  1570. {
  1571.     -------------------------------------------------------------------------
  1572.     ** Time functions
  1573.     **    
  1574.     **    OTGetTimeStamp returns time in "tick" numbers, stored in 64 bits.
  1575.     **    This timestamp can be used as a base number for calculating elapsed 
  1576.     **    time.
  1577.     **    OTSubtractTimeStamps returns a pointer to the "result" parameter.
  1578.     **        
  1579.     **    OTGetClockTimeInSecs returns time since Open Transport was initialized
  1580.     **        in seconds.
  1581.     ------------------------------------------------------------------------- 
  1582. }
  1583.  
  1584. TYPE
  1585.     OTTimeStamp                            = UnsignedWide;
  1586.     OTTimeStampPtr                         = ^OTTimeStamp;
  1587. PROCEDURE OTGetTimeStamp(VAR stamp: OTTimeStamp); C;
  1588. FUNCTION OTSubtractTimeStamps(VAR result: OTTimeStamp; VAR startTime: OTTimeStamp; VAR endTime: OTTimeStamp): OTTimeStampPtr; C;
  1589. FUNCTION OTTimeStampInMilliseconds(VAR delta: OTTimeStamp): UInt32; C;
  1590. FUNCTION OTTimeStampInMicroseconds(VAR delta: OTTimeStamp): UInt32; C;
  1591. FUNCTION OTElapsedMilliseconds(VAR startTime: OTTimeStamp): UInt32; C;
  1592. FUNCTION OTElapsedMicroseconds(VAR startTime: OTTimeStamp): UInt32; C;
  1593. FUNCTION OTGetClockTimeInSecs: UInt32; C;
  1594. {
  1595.     -------------------------------------------------------------------------
  1596.     ** OTLIFO
  1597.     **
  1598.     ** These are functions to implement a LIFO list that is interrupt-safe.
  1599.     ** The only function which is not is OTReverseList.  Normally, you create
  1600.     ** a LIFO list, populate it at interrupt time, and then use OTLIFOStealList
  1601.     ** to atomically remove the list, and OTReverseList to flip the list so that
  1602.     ** it is a FIFO list, which tends to be more useful.
  1603.     ------------------------------------------------------------------------- 
  1604. }
  1605.  
  1606. TYPE
  1607.     OTLinkPtr = ^OTLink;
  1608.     OTLIFOPtr = ^OTLIFO;
  1609.     OTLIFO = RECORD
  1610.         fHead:                    OTLinkPtr;
  1611.     END;
  1612.  
  1613.     OTLink = RECORD
  1614.         fNext:                    OTLinkPtr;
  1615.     END;
  1616.  
  1617. {
  1618.  This function puts "object" on the listHead, and places the
  1619.  previous value at listHead into the pointer at "object" plus
  1620.  linkOffset.
  1621. }
  1622. PROCEDURE OTEnqueue(VAR listHead: UNIV Ptr; object: UNIV Ptr; linkOffset: size_t); C;
  1623. {
  1624.  This function returns the head object of the list, and places
  1625.  the pointer at "object" + linkOffset into the listHead
  1626. }
  1627. FUNCTION OTDequeue(VAR listHead: UNIV Ptr; linkOffset: size_t): Ptr; C;
  1628. {  This function atomically enqueues the link onto the list }
  1629. PROCEDURE OTLIFOEnqueue(VAR list: OTLIFO; VAR link: OTLink); C;
  1630. {
  1631.  This function atomically dequeues the first element
  1632.  on the list
  1633. }
  1634. FUNCTION OTLIFODequeue(VAR list: OTLIFO): OTLinkPtr; C;
  1635. {
  1636.  This function atomically empties the list and returns a
  1637.  pointer to the first element on the list
  1638. }
  1639. FUNCTION OTLIFOStealList(VAR list: OTLIFO): OTLinkPtr; C;
  1640. {
  1641.  This function reverses a list that was stolen by
  1642.  OTLIFOStealList.  It is NOT atomic.  It returns the
  1643.  new starting list.
  1644. }
  1645. FUNCTION OTReverseList(VAR list: OTLink): OTLinkPtr; C;
  1646. {
  1647.     -------------------------------------------------------------------------
  1648.     ** OTList
  1649.     **
  1650.     ** An OTList is a non-interrupt-safe list, but has more features than the
  1651.     ** OTLIFO list. It is a standard singly-linked list.
  1652.     ------------------------------------------------------------------------- 
  1653. }
  1654.  
  1655. TYPE
  1656.     OTListPtr = ^OTList;
  1657.     OTList = RECORD
  1658.         fHead:                    OTLinkPtr;
  1659.     END;
  1660.  
  1661.     OTListSearchProcPtr = ProcPtr;  { FUNCTION OTListSearch(ref: UNIV Ptr; VAR linkToCheck: OTLink): BOOLEAN; C; }
  1662.  
  1663. {  Add the link to the list at the front }
  1664. PROCEDURE OTAddFirst(VAR list: OTList; VAR link: OTLink); C;
  1665. {  Add the link to the list at the end }
  1666. PROCEDURE OTAddLast(VAR list: OTList; VAR link: OTLink); C;
  1667. {  Remove the first link from the list }
  1668. FUNCTION OTRemoveFirst(VAR list: OTList): OTLinkPtr; C;
  1669. {  Remove the last link from the list }
  1670. FUNCTION OTRemoveLast(VAR list: OTList): OTLinkPtr; C;
  1671. {  Return the first link from the list }
  1672. FUNCTION OTGetFirst(VAR list: OTList): OTLinkPtr; C;
  1673. {  Return the last link from the list }
  1674. FUNCTION OTGetLast(VAR list: OTList): OTLinkPtr; C;
  1675. {  Return true if the link is present in the list }
  1676. FUNCTION OTIsInList(VAR list: OTList; VAR link: OTLink): BOOLEAN; C;
  1677. {
  1678.  Find a link in the list which matches the search criteria
  1679.  established by the search proc and the refPtr.  This is done
  1680.  by calling the search proc, passing it the refPtr and each
  1681.  link in the list, until the search proc returns true.
  1682.  NULL is returned if the search proc never returned true.
  1683. }
  1684. FUNCTION OTFindLink(VAR listPtr: OTList; procPtr: OTListSearchProcPtr; refPtr: UNIV Ptr): OTLinkPtr; C;
  1685. {  Remove the specified link from the list, returning true if it was found }
  1686. FUNCTION OTRemoveLink(VAR listPtr: OTList; VAR linkPtr: OTLink): BOOLEAN; C;
  1687. {  Similar to OTFindLink, but it also removes it from the list. }
  1688. FUNCTION OTFindAndRemoveLink(VAR list: OTList; proc: OTListSearchProcPtr; refPtr: UNIV Ptr): OTLinkPtr; C;
  1689. {  Return the "index"th link in the list }
  1690. FUNCTION OTGetIndexedLink(VAR list: OTList; index: size_t): OTLinkPtr; C;
  1691. {
  1692.     -------------------------------------------------------------------------
  1693.     ** Atomic Operations
  1694.     **
  1695.     ** The Bit operations return the previous value of the bit (0 or non-zero).
  1696.     ** The memory pointed to must be a single byte and only bits 0 through 7 are
  1697.     ** valid.  Bit 0 corresponds to a mask of 0x01, and Bit 7 to a mask of 0x80.
  1698.     ------------------------------------------------------------------------- 
  1699. }
  1700.  
  1701. TYPE
  1702.     OTLock                                = UInt8;
  1703. FUNCTION OTAtomicSetBit(VAR ptr: UInt8; len: size_t): BOOLEAN; C;
  1704. FUNCTION OTAtomicClearBit(VAR ptr: UInt8; len: size_t): BOOLEAN; C;
  1705. FUNCTION OTAtomicTestBit(VAR ptr: UInt8; len: size_t): BOOLEAN; C;
  1706. {
  1707.  WARNING! void* and UInt32 locations MUST be on 4-byte boundaries.
  1708.             UInt16 locations must not cross a 4-byte boundary.
  1709. }
  1710. FUNCTION OTCompareAndSwapPtr(oldValue: UNIV Ptr; newValue: UNIV Ptr; VAR location: UNIV Ptr): BOOLEAN; C;
  1711. FUNCTION OTCompareAndSwap32(oldValue: UInt32; newValue: UInt32; VAR location: UInt32): BOOLEAN; C;
  1712. FUNCTION OTCompareAndSwap16(oldValue: UInt32; newValue: UInt32; VAR location: UInt16): BOOLEAN; C;
  1713. FUNCTION OTCompareAndSwap8(oldValue: UInt32; newValue: UInt32; VAR location: UInt8): BOOLEAN; C;
  1714. {
  1715.  WARNING! UInt32 locations MUST be on 4-byte boundaries.
  1716.             UInt16 locations must not cross a 4-byte boundary.
  1717. }
  1718. FUNCTION OTAtomicAdd32(val: SInt32; VAR ptr: SInt32): SInt32; C;
  1719. FUNCTION OTAtomicAdd16(val: SInt16; VAR ptr: SInt16): SInt16; C;
  1720. FUNCTION OTAtomicAdd8(val: SInt8; VAR ptr: SInt8): SInt8; C;
  1721. {$ALIGN RESET}
  1722. {$POP}
  1723.  
  1724. {$SETC UsingIncludes := OpenTransportIncludes}
  1725.  
  1726. {$ENDC} {__OPENTRANSPORT__}
  1727.  
  1728. {$IFC NOT UsingIncludes}
  1729.  END.
  1730. {$ENDC}
  1731.